import { postFormData, postFlie, post, downFile, get } from '@/utils/http'
import { storageGet } from '@/utils'
export default {
    systemLogin(param){//登录
        return postFormData({
            url: '/api/login/systemLogin',
            data: param
        })
    },
    lucenesearch(param){//搜索
        return get({
            url: '/lucene/search',
            data: param
        })
    },
    viewPdfTest(param){//pdf地址
        return downFile({
            url: '/lucene/viewPdfTest',
            data: param
        })
    },

    cyDirqueryAll(param){//库树
        return get({
            url: '/api/cyDir/queryAll',
            data: param
        })
    },
    cyDirsaveOne(param){//库树-新增
        return postFormData({
            url: '/api/cyDir/saveOne',
            data: param
        })
    },
    cyDirdeleteById(param){//库树-删除
        return get({
            url: '/api/cyDir/deleteById',
            data: param
        })
    },
    cyFileuploadFile(param){//库树-上传
        return postFormData({
            url: '/api/cyFile/uploadFile',
            data: param
        })
    },
    uploadZip(param){//库树-批量上次
        return postFormData({
            url: '/api/cyFile/uploadZip',
            data: param
        })
    },
    cyFilequeryAllSplit(param){//库-文件列表
        return get({
            url: '/api/cyFile/queryAllSplit',
            data: param
        })
    },
    cyFiledeleteById(param){//库-文件列表-删除
        return get({
            url: '/api/cyFile/deleteById',
            data: param
        })
    },
    cyFilesaveOne(param){//库-文件列表-修改
        return postFormData({
            url: '/api/cyFile/saveOne',
            data: param
        })
    },
    checkFileExist(param){//库-查看文件是否存在
        return get({
            url: '/api/cyFile/checkFileExist',
            data: param
        })
    },

    cyFiledownloadById(param){//库-文件列表-下载
        this.checkFileExist({
            idList: param.id
        }).then(res => {
            if(res.status == 1){
                downFile({
                    url: '/api/cyFile/downloadById',
                    data: param
                })
            }
        })
        // return downFile({
        //     url: '/api/cyFile/downloadById',
        //     data: param
        // })
    },
    downloadAllWithDir(param){//库-文件列表-压缩包下载
        return downFile({
            url: '/api/cyFile/downloadAllWithDir',
            data: param
        })
    },
    cyFiledownloadByIds(param){//库-文件列表-批量下载
        this.checkFileExist(param).then(res => {
            if(res.status == 1){
                downFile({
                    url: '/api/cyFile/downloadByIds',
                    data: param,
                    type: 'POST'
                })
            }
        })
        // return downFile({
        //     url: '/api/cyFile/downloadByIds',
        //     data: param,
        //     type: 'POST'
        // })
    },

    clearFavorites(param){//库-文件列表-删除
        return get({
            url: '/api/cyFile/clearFavorites',
            data: param
        })
    },
    cyFilequeryRecord(param){//库-文件列表-查看浏览/下载记录
        return get({
            url: '/api/cyFile/queryRecord',
            data: param
        })
    },
    clearRecord(param){//库-文件列表-清空浏览/下载记录
        return get({
            url: '/api/cyFile/clearRecord',
            data: param
        })
    },
    downloadHelpDoc(param){//下载用户手册
        return downFile({
            url: '/api/cyFile/downloadHelpDoc',
            data: param
        })
    },
    getHotReviewFileList(param){//获取热搜文件列表
        return get({
            url: '/lucene/getHotReviewFileList',
            data: param
        })
    },
    getHotSearchList(param){//获取热搜记录
        return get({
            url: '/lucene/getHotSearchList',
            data: param
        })
    },
    cyGptInfosaveOne(param){//ai配置-保存
        return postFormData({
            url: '/api/cyGptInfo/saveOne',
            data: param
        })
    },
    cyGptInfoqueryAllNotPage(param){//ai配置-获取
        return get({
            url: '/api/cyGptInfo/queryAllNotPage',
            data: param
        })
    }

}